<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
  <style>
    .el-header {
      background-color: #B3C0D1;
      color: #333;
      text-align: center;
      line-height: 60px;
    }
    .el-header>h1 {
      font-size: 24px;
      margin-top: 0px;
      margin-bottom: 0px;
    }

    .el-aside {
      height: 500px;
      background-color: #D3DCE6;
      color: #333;
      text-align: center;
      line-height: 200px;
    }

    .el-main {
      background-color: #E9EEF3;
      color: #333;
      text-align: center;
      line-height: 160px;
    }

    body > .el-container {
      margin-bottom: 40px;
    }

    .el-container:nth-child(5) .el-aside,
    .el-container:nth-child(6) .el-aside {
      line-height: 260px;
    }

    .el-container:nth-child(7) .el-aside {
      line-height: 320px;
    }
    #yg_h1 {
      line-height: 20px;
      font-size: 25px;
    }
  </style>
</head>
<body>
<div id="app">
  <el-container>
    <el-header><h1>达内员工管理系统</h1></el-header>
    <el-container>
      <el-aside width="200px">
        <div>
          <el-menu
                  default-active="2"
                  class="el-menu-vertical-demo"
                  @open="handleOpen"
                  @close="handleClose">
            <el-submenu index="1">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>导航一</span>
              </template>
              <el-menu-item index="1-1">选项1</el-menu-item>
              <el-menu-item index="1-2">选项2</el-menu-item>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="el-icon-location"></i>
                <span>导航二</span>
              </template>
              <el-menu-item index="2-1">选项1</el-menu-item>
              <el-menu-item index="2-2">选项2</el-menu-item>
            </el-submenu>
          </el-menu>
        </div>
      </el-aside>
      <el-main>
        <h1 id="yg_h1">员工列表</h1>
        <div>
          <template>
            <el-table
                    :data="arr"
                    style="width: 100%;margin: 0px auto;padding-left: 350px">
              <el-table-column
                      type="index"
                      label="序号"
                      width="180"
              ></el-table-column>
              <el-table-column
                      prop="name"
                      label="员工姓名"
                      width="220">
              </el-table-column>
              <el-table-column
                      prop="age"
                      label="员工年龄"
                      width="220">
              </el-table-column>
              <el-table-column
                      prop="job"
                      label="员工工作"
                      width="220">
              </el-table-column>
              <el-table-column
                      label="操作"
                      width="100">
                <template slot-scope="scope">
                  <el-button
                          size="mini"
                          type="danger"
                          @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </template>
        </div>
      </el-main>
    </el-container>
  </el-container>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
 let v = new Vue({
    el: '#app',
    data: function() {
      return {
        arr: [
          {name: "张三",age: "21", job: "保洁"},
          {name: "李四",age: "22", job: "保安"},
          {name: "王五",age: "23", job: "司机"}
        ],
        e: {name: "",age: "", job: ""}
      }
    },
    methods:{
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      handleDelete(i,e) {
        v.arr.splice(i, 1);
        v.$message(e.name+"被删除了！");
      }
    }
  })
</script>
</html>